﻿<!--#include file="const.inc"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>
<%
IF  Request.QueryString("Action")="save" Then
	call saves
else
	call indexs
end if
End Function

Function indexs
	dim rs,sql,id,smoney,we,we0,dao,sou,zi,zi0
	id=Request.QueryString("id")
	if id="" then id=0
	if not isnumeric(id) then id=0
	id=clng(id)
select case v
case "0"
we0="<br/>"
%>
<card title="下订单"><p align="<%=qingtian.px%>">
<%
case "1"
hr=""
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
%>
<title>下订单</title>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%
End Select
if sid="Null" then
%><%=dao%><%=zi%>你还没登录请<%=zi0%><a href="/login.asp?sid=<%=sidd%>&amp;url=/shop/viewshopp.asp?id=<%=id%>">登陆</a>后再留览<%=we0%>
<%
else
	qingtian.info	
        Response.Write qingtian.qingsav("581")
        Response.Write dao
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 [name],[id1],[smoney] from [qingtian_shop] where id="&id
        Rs.Open Sql,conn,1,1
	if not (rs.bof and rs.eof) then
        smoney=rs("smoney")
        Response.Write (""&qingtian.utf8(rs("name"))&"<br/>")
        Response.Write ("商品编号:"&rs("id1")&"<br/>")
        Response.Write ("销售价:￥"&rs("smoney")&"元")
        else
        Response.Write ("暂无该商品！")
        end if
	rs.close
        Response.Write we0
if v=1 then Response.Write ("<form action=""pay.asp?Action=save&amp;smoney="&smoney&"&amp;id="&id&"&amp;sid="&sidd&""" method=""post"">")
        Response.Write ("订购数量:<input name='solid' format='*N' size='5' maxlength='5'/><br/>")
	Sql = "select top 1 [name],[diqu],[mobile] from [qingtian_user] where id="&qingtian.nid
        Rs.Open Sql,conn,1,1
	if not (rs.bof and rs.eof) then
        Response.Write (""&we&"姓名(请填写真实姓名以免延误收货):"&we0&"<input type='text' name='name1' value='"&qingtian.utf8(rs("name"))&"' size='25'/><br/>")
        Response.Write (""&sou&"电话(务必填写真实的电话):"&we0&"<input type='text' name='mobile' value='"&rs("mobile")&"' size='25'/><br/>")
        Response.Write (""&we&"收货地址:(务必填写真实的收货地址):"&we0&"<input type='text' name='diqu' value='"&qingtian.utf8(rs("diqu"))&"' size='25'/><br/>")
        else
        Response.Write (""&sou&"姓名(请填写真实姓名以免延误收货):"&we0&"<input type='text' name='name1' value='' size='25'/><br/>")
        Response.Write (""&we&"电话(务必填写真实的电话):"&we0&"<input type='text' name='mobile' value='' size='25'/><br/>")
        Response.Write (""&sou&"收货地址+邮编:"&we0&"<input type='text' name='diqu' value='' size='25'/><br/>")
        end if
	rs.close
        set rs=nothing
        Response.Write we
        Response.Write ("送货日期:<select name='day' value='任意日期'><option value='任意日期'>任意日期</option><option value='仅工作日'>仅工作日</option><option value='仅休息日'>仅休息日</option></select>")
        Response.Write ("时间:<select name='time' value='任意时间段'><option value='任意时间段'>任意时间段</option><option value='上午'>上午</option><option value='下午'>下午</option><option value='晚上'>晚上</option></select>"&we0&"")
        Response.Write (""&sou&"订单附言(对时间有特殊要求或对商品有特殊要求请详细填写):"&we0&"<input type='text' name='non' value='' size='25'/><br/>")
if v=1 then
        Response.Write ("<input type=""submit"" value=""确定订购"" />")
else
        Response.Write ("<anchor>确定订购<go href='pay.asp?Action=save&amp;smoney="&smoney&"&amp;id="&id&"&amp;sid="&sidd&"' method='post'><postfield name=""solid"" value=""$(solid:n)"" /><postfield name=""name1"" value=""$(name1)"" /><postfield name=""mobile"" value=""$(mobile)"" /><postfield name=""diqu"" value=""$(diqu)"" /><postfield name=""day"" value=""$(day)"" /><postfield name=""time"" value=""$(time)"" /><postfield name=""non"" value=""$(non)"" /></go></anchor>")
end if
        Response.Write we0
end if 
        Response.Write qingtian.qingsav("580")
Response.Write("" & dao & "<a href='/index.asp?sid="&sidd&"'>首页</a>|<a href='fileve.asp?id="&id&"&amp;sid="&sidd&"'>上级</a>|<a href='dindian.asp?sid="&sidd&"'>订单</a>|<a href='viewshopp.asp?sid="&sidd&"'>购物</a><br/>")    
End Function
Function saves
dim rs,sql,id,smoney,we,we0,dao,sou,zi,zi0,solid,name1,mobile,diqu,day,time,non,errs
select case v
case "0"
we0="<br/>"
%>
<card title="下订单"><p align="<%=qingtian.px%>">
<%
case "1"
hr=""
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
%>
<title>下订单</title>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%
End Select
	id=Request.QueryString("id")
	if id="" then id=0
	if not isnumeric(id) then id=0
	id=clng(id)

	smoney=Request.QueryString("smoney")
	if smoney="" then smoney=0
	if not isnumeric(smoney) then smoney=0
	smoney=clng(smoney)

        solid=Request.form("solid")
        name1=Request.form("name1")
        mobile=Request.form("mobile")
        diqu=Request.form("diqu")
        day=Request.form("day")
        time=Request.form("time")
        non=Request.form("non")
        errs=""
if solid=""  or name1="" or mobile="" or diqu="" or day="" or time="" then
        errs="输入错误，任意一项不能为空！"
end if
	
	IF len(errs)=0 then

		set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select *  FROM qingtian_shopd"
		rs.open sql,conn,1,3
		rs.addnew()
			rs("nid")=qingtian.nid
			rs("soid")=id
			rs("name")=name1
			rs("aurl")=diqu
			rs("phoneid")=mobile
			rs("daytime")="送货日期:"&day&"时间:"&time
			rs("non")=non
			rs("solid")=solid
			rs("money")=smoney
			rs("todd")="未审核"
		rs.update()
		rs.Close
		Sql = "select  * FROM qingtian_shopp where soid="&id&" and nid="&qingtian.nid
		rs.open sql,conn,1,3
		if not (rs.bof and rs.eof) then
		rs.delete
		end if
		rs.Close
		Sql = "select  * FROM qingtian_shop where id="&id
		rs.open sql,conn,1,3
		if not (rs.bof and rs.eof) then
                rs("soid")=rs("soid")+1
		rs.update()
		end if
		rs.Close
				set rs8=Server.CreateObject("Adodb.Recordset")
  				sql8="select top 1 id,sidd FROM [qingtian_user] where [bbs]=true order by id asc"
  				rs8.open sql8,conn,1,1
                                if not (rs8.bof and rs8.eof)  then
                                qingtian.addnfo(rs8("id")&"tt"&"站长你好![url=/user/spacev?nid="&qingtian.nid&"&sid=[sid]]"&name1&"(ID:"&qingtian.nid&")[/url]在你的网站里订购了价值为"&smoney&"元的商品!")
                                end if
                                rs8.close
                                set rs8=nothing
		%><%=we%>添加新订单成功!<%=we0%><%
	Set rs = Nothing

	else
%>
		<%=we%><%=errs%><%=we0%>
		<%=sou%><a href="pay.asp?id=<%=id%>&amp;sid=<%=sidd%>">返回上级</a><%=we0%>
<%	end if
         Response.Write qingtian.qingsav("580")
Response.Write("" & dao & "<a href='/index.asp?sid="&sidd&"'>首页</a>|<a href='fileve.asp?id="&id&"&amp;sid="&sidd&"'>上级</a>|<a href='dindian.asp?sid="&sidd&"'>订单</a>|<a href='viewshopp.asp?sid="&sidd&"'>购物</a><br/>")  
End Function
%>




